import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.Buffer;


public class seisinvertir {

	
	public static void main(String[] args) throws IOException {
		int n1;		
		String frase = "";
		System.out.println("digite el numero");
		BufferedReader opcion = new BufferedReader ( new InputStreamReader(System.in));
	    frase = opcion.readLine(); 
	    n1 = Integer.parseInt(frase);
	    int r=invertir(n1);
	    System.out.println(r);	
	    	
	}
		
		public static int invertir(int n1){
			
			if(n1<10)
				return n1;
			else{
				System.out.println(n1%10);
				return invertir(n1/10);
			}			
	}


}